/**
 * @author harae Feng 
 * @date 2019-09-17 18:09:58 
 * @Last Modified by: harae Feng
 * @Last Modified time: 2019-10-18 17:32:35
 * @Describe API错误处理统一类
 */

const ResultAPI = require('./resultAPI')

/**
 *try/catch处理
 *
 * @param {*} dirname   __dirname
 * @param {*} filename  __filename
 * @param {*} error     error
 * @returns
 */
function catchHandle(dirname, filename, error){
    console.warn(`--[ERROR]--${filename} error: ${error}`)
    console.log(`--[ERROR]--${filename} error: ${error}`)
    return new ResultAPI(1, {parms: '程序错误'})
}

module.exports = catchHandle